<template>
  <div class="basic-info">
    <el-form :model="form" ref="form" label-width="108px" size="mini" :rules="addRules" :disabled="formDisabled || mode === 'view'">
      <el-row :gutter="24">
        <!-- 原有部分保持不变... -->

        <!-- 基本药物、基药类型等 -->
        <el-col :xs="24" :sm="24" :md="12" :lg="8" :xl="8">
          <el-form-item label="基本药物：" prop="basMednB">
            <el-select v-model="form.basMednB" @change="updateForm">
              <el-option 
                v-for="item in YNoptions" 
                :key="item.value" 
                :label="item.label" 
                :value="item.id">
              </el-option>
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :xs="24" :sm="24" :md="12" :lg="8" :xl="8">
          <el-form-item label="基药类型：" prop="basMednType">
            <el-select 
              v-model="form.basMednType" 
              @change="updateForm" 
              :disabled="form.basMednB !== '1'"
              placeholder="请选择">
              <el-option 
                v-for="item in YNoptions" 
                :key="item.value" 
                :label="item.label" 
                :value="item.id">
              </el-option>
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :xs="24" :sm="24" :md="12" :lg="8" :xl="8">
          <el-form-item label="用法用量：" prop="usedMtd">
            <el-input 
              v-model="form.usedMtd" 
              @blur="updateForm">
            </el-input>
          </el-form-item>
        </el-col>

        <!-- 开单数量相关 -->
        <el-col :xs="24" :sm="24" :md="12" :lg="8" :xl="8">
          <el-form-item label="开单数量上限：" prop="lmtCnt">
            <el-input 
              v-model="form.lmtCnt" 
              @blur="updateForm">
            </el-input>
          </el-form-item>
        </el-col>
        <el-col :xs="24" :sm="24" :md="12" :lg="8" :xl="8">
          <el-form-item label="开单数量提醒：" prop="lmtCntRemind">
            <el-checkbox 
			style="margin-left: -58px;"
              v-model="form.lmtCntRemind" 
              @change="updateForm">
            </el-checkbox>
          </el-form-item>
        </el-col>
        <el-col :xs="24" :sm="24" :md="12" :lg="8" :xl="8">
          <el-form-item label="默认制法：" prop="methodType">
            <el-select v-model="form.methodType" @change="updateForm">
              <el-option 
                v-for="item in methodTypeOptions" 
                :key="item.value" 
                :label="item.label" 
                :value="item.id">
              </el-option>
            </el-select>
          </el-form-item>
        </el-col>

        <!-- 限定用药相关 -->
        <el-col :xs="24" :sm="24" :md="12" :lg="8" :xl="8">
          <el-form-item label="限定用药：" prop="lmtUsedB">
            <el-select v-model="form.lmtUsedB" @change="updateForm">
              <el-option 
                v-for="item in YNoptions" 
                :key="item.value" 
                :label="item.label" 
                :value="item.id">
              </el-option>
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :xs="24" :sm="24" :md="12" :lg="8" :xl="8">
          <el-form-item label="限定备注：" prop="lmtUsedRemark">
            <el-input 
              v-model="form.lmtUsedRemark" 
              @blur="updateForm">
            </el-input>
          </el-form-item>
        </el-col>
        <el-col :xs="24" :sm="24" :md="12" :lg="8" :xl="8">
          <el-form-item label="适用范围：" prop="lmtSpc">
            <el-select v-model="form.lmtSpc" @change="updateForm">
              <el-option 
                v-for="item in UseOptions" 
                :key="item.value" 
                :label="item.label" 
                :value="item.id">
              </el-option>
            </el-select>
          </el-form-item>
        </el-col>

        <!-- 文本域部分 -->
        <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24">
          <el-form-item label="药理作用：" prop="phamAction">
            <el-input 
              type="textarea" 
              :rows="2" 
              v-model="form.phamAction" 
              @blur="updateForm">
            </el-input>
          </el-form-item>
        </el-col>
        <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24">
          <el-form-item label="不良反应：" prop="defs">
            <el-input 
              type="textarea" 
              :rows="2" 
              v-model="form.defs" 
              @blur="updateForm">
            </el-input>
          </el-form-item>
        </el-col>
        <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24">
          <el-form-item label="禁忌说明：" prop="tabo">
            <el-input 
              type="textarea" 
              :rows="2" 
              v-model="form.tabo" 
              @blur="updateForm">
            </el-input>
          </el-form-item>
        </el-col>

        <!-- 原有部分保持不变... -->
      </el-row>
    </el-form>
  </div>
</template>

<script>
export default {
  props: {
    form: {
      type: Object,
      required: true
    },
    formDisabled: {
      type: Boolean,
      default: false
    },
    mode: {
      type: String,
      default: 'add' // 'add', 'edit', 'view'
    }
  },
  data() {
    return {
      // 原有选项数据...
      methodTypeOptions: [], // 默认制法选项
      YNoptions:[{id:0,label:'否',value:'否'},{id:1,label:'是',value:'是'}],
	  UseOptions:[{ id:0,label:'全院',value:'全院'},{ id:1,label:'门诊',value:'门诊'},{ id:2,label:'其他',value:'其他'}], // 适用范围
	  addRules:{}
    };
  },
  methods: {
    updateForm() {
    	this.$emit('update', this.form);
    },
  },
	created() {
		// 原有created...
	},
	mounted() {
		
	}
	
};
</script>

<style lang="less" scoped>
/deep/ .el-form-item{
  margin-bottom: 8px;
}
.basic-info {
  padding: 4px;
  /deep/ .el-form-item__label{
    font-size: 12px;
  }
  /deep/ .el-input__inner{
    padding: 0 4px;
  }
  /deep/ .el-form-item__content{
    display: flex;
    justify-content: space-around;
  }
  /deep/ .el-input--mini .el-input__inner{
    height: 26px;
  }
}
</style>